#include <rid.h>
#include <stdio.h>
#include <string.h>

#define STYLE_9
#include <fn85.h>
#include "rid_fn85.h"

void
rid_fn85(char *str, const Rid id)
{
	fn85_encode(str, id, 4);
	str[RID_FN85_LEN] = '\0';
}

Fn85_err
rid_fn85_parse(Rid id, const char *str, size_t *pos, const char **error)
{
	return fn85_decode(id, str, 4, pos, error);
}

void
rid_fn85_path(char *path, const Rid id)
{
	rid_fn85(path + 2, id);
	path[0] = path[2];
	path[1] = '/';
	path[2] = path[3];
	path[3] = '/';
}
